﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="Employees.aspx.cs" Inherits="EC2011_hk1_BT3_1041061_1041129_1041130.WebForm3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderTitle" runat="server">
    LIST EMPLOYEES
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderContent" runat="server">
   <%-- <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource2">
    </asp:Repeater>--%>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" DataKeyNames="EmployeeID" 
        DataSourceID="SqlDataSource1" BackColor="White" BorderColor="#999999" 
        BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" 
        GridLines="Vertical">
        <AlternatingRowStyle BackColor="#CCCCCC" />
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            <asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" 
                InsertVisible="False" ReadOnly="True" SortExpression="EmployeeID" />
            <asp:BoundField DataField="LastName" HeaderText="LastName" 
                SortExpression="LastName" />
            <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="DepartmentID" HeaderText="DepartmentID" 
                SortExpression="DepartmentID" />
            <asp:BoundField DataField="Salary" HeaderText="Salary" 
                SortExpression="Salary" />
            <asp:BoundField DataField="HireDate" HeaderText="HireDate" 
                SortExpression="HireDate" />
            <asp:BoundField DataField="URLPersonalPhoto" HeaderText="URLPersonalPhoto" 
                SortExpression="URLPersonalPhoto" />
            <asp:BoundField DataField="Description" HeaderText="Description" 
                SortExpression="Description" />
        </Columns>
        <FooterStyle BackColor="#CCCCCC" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F1F1F1" />
        <SortedAscendingHeaderStyle BackColor="#808080" />
        <SortedDescendingCellStyle BackColor="#CAC9C9" />
        <SortedDescendingHeaderStyle BackColor="#383838" />
    </asp:GridView>  
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:PagingDataConnectionString %>" 
        DeleteCommand="DELETE FROM [Employees] WHERE [EmployeeID] = @EmployeeID" 
        InsertCommand="INSERT INTO [Employees] ([LastName], [FirstName], [DepartmentID], [Salary], [HireDate], [URLPersonalPhoto], [Description]) VALUES (@LastName, @FirstName, @DepartmentID, @Salary, @HireDate, @URLPersonalPhoto, @Description)" 
        SelectCommand="SELECT * FROM [Employees] WHERE ([DepartmentID] = @DepartmentID)" 
        UpdateCommand="UPDATE [Employees] SET [LastName] = @LastName, [FirstName] = @FirstName, [DepartmentID] = @DepartmentID, [Salary] = @Salary, [HireDate] = @HireDate, [URLPersonalPhoto] = @URLPersonalPhoto, [Description] = @Description WHERE [EmployeeID] = @EmployeeID">
        <DeleteParameters>
            <asp:Parameter Name="EmployeeID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="DepartmentID" Type="Int32" />
            <asp:Parameter Name="Salary" Type="Decimal" />
            <asp:Parameter Name="HireDate" Type="DateTime" />
            <asp:Parameter Name="URLPersonalPhoto" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="DepartmentID" QueryStringField="Id" 
                Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="DepartmentID" Type="Int32" />
            <asp:Parameter Name="Salary" Type="Decimal" />
            <asp:Parameter Name="HireDate" Type="DateTime" />
            <asp:Parameter Name="URLPersonalPhoto" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="EmployeeID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" 
        AutoGenerateRows="False" DataKeyNames="EmployeeID" 
        DataSourceID="SqlDataSource1" Height="50px" Width="621px" 
        BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" 
        CellPadding="3" CellSpacing="1" GridLines="None">
        <EditRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
        <Fields>
            <asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" 
                InsertVisible="False" ReadOnly="True" SortExpression="EmployeeID" />
            <asp:BoundField DataField="LastName" HeaderText="LastName" 
                SortExpression="LastName" />
            <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="DepartmentID" HeaderText="DepartmentID" 
                SortExpression="DepartmentID" />
            <asp:BoundField DataField="Salary" HeaderText="Salary" 
                SortExpression="Salary" />
            <asp:BoundField DataField="HireDate" HeaderText="HireDate" 
                SortExpression="HireDate" />
            <asp:BoundField DataField="URLPersonalPhoto" HeaderText="URLPersonalPhoto" 
                SortExpression="URLPersonalPhoto" />
            <asp:BoundField DataField="Description" HeaderText="Description" 
                SortExpression="Description" />
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                ShowInsertButton="True" />
        </Fields>
        <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
        <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
        <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
        <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
    </asp:DetailsView>
    <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource2">
    </asp:Repeater>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:PagingDataConnectionString %>" 
        DeleteCommand="DELETE FROM [Employees] WHERE [EmployeeID] = @EmployeeID" 
        InsertCommand="INSERT INTO [Employees] ([LastName], [FirstName], [DepartmentID], [Salary], [HireDate], [URLPersonalPhoto], [Description]) VALUES (@LastName, @FirstName, @DepartmentID, @Salary, @HireDate, @URLPersonalPhoto, @Description)" 
        SelectCommand="SELECT * FROM [Employees] WHERE ([DepartmentID] = @DepartmentID)" 
        UpdateCommand="UPDATE [Employees] SET [LastName] = @LastName, [FirstName] = @FirstName, [DepartmentID] = @DepartmentID, [Salary] = @Salary, [HireDate] = @HireDate, [URLPersonalPhoto] = @URLPersonalPhoto, [Description] = @Description WHERE [EmployeeID] = @EmployeeID">
        <DeleteParameters>
            <asp:Parameter Name="EmployeeID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="DepartmentID" Type="Int32" />
            <asp:Parameter Name="Salary" Type="Decimal" />
            <asp:Parameter Name="HireDate" Type="DateTime" />
            <asp:Parameter Name="URLPersonalPhoto" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="DepartmentID" QueryStringField="Id" 
                Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="DepartmentID" Type="Int32" />
            <asp:Parameter Name="Salary" Type="Decimal" />
            <asp:Parameter Name="HireDate" Type="DateTime" />
            <asp:Parameter Name="URLPersonalPhoto" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="EmployeeID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:DataList ID="DataList2" runat="server" BackColor="White" 
        BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" 
        DataKeyField="EmployeeID" DataSourceID="SqlDataSource2" ForeColor="Black" 
        GridLines="Vertical" RepeatDirection="Horizontal" RepeatLayout="Flow" 
        ShowFooter="False" ShowHeader="False" Width="624px">
        <AlternatingItemStyle BackColor="#CCCCCC" />
        <FooterStyle BackColor="#CCCCCC" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <ItemTemplate>
            EmployeeID:
            <asp:Label ID="EmployeeIDLabel" runat="server" 
                Text='<%# Eval("EmployeeID") %>' />
            <br />
            LastName:
            <asp:Label ID="LastNameLabel" runat="server" Text='<%# Eval("LastName") %>' />
            <br />
            FirstName:
            <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Eval("FirstName") %>' />
            <br />
            DepartmentID:
            <asp:Label ID="DepartmentIDLabel" runat="server" 
                Text='<%# Eval("DepartmentID") %>' />
            <br />
            Salary:
            <asp:Label ID="SalaryLabel" runat="server" Text='<%# Eval("Salary") %>' />
            <br />
            HireDate:
            <asp:Label ID="HireDateLabel" runat="server" Text='<%# Eval("HireDate") %>' />
            <br />
            URLPersonalPhoto:
            <asp:Label ID="URLPersonalPhotoLabel" runat="server" 
                Text='<%# Eval("URLPersonalPhoto") %>' />
            <br />
            Description:
            <asp:Label ID="DescriptionLabel" runat="server" 
                Text='<%# Eval("Description") %>' />
            <br />
<br />
        </ItemTemplate>
        <SelectedItemStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
    </asp:DataList>
</asp:Content>
